Fix --extern for doc tests for the local crate.
authorAlex Crichton <alex@alexcrichton.com>
Thu, 7 Aug 2014 15:26:38 +0000 (08:26 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Thu, 7 Aug 2014 15:29:32 +0000 (08:29 -0700)
Closes #340

src/cargo/ops/cargo_rustc/fingerprint.rs
tests/test_cargo_compile_git_deps.rs
tests/test_cargo_test.rs

index 0626ec06898e6512c46edad6a906972e82e8e1ef..323150f0129703eedc9ebc99c314cc1a599de47d 100644 (file)
@@ -82,7 +82,7 @@ pub fn prepare_target(cx: &mut Context, pkg: &Package, target: &Target,
                 cx.compilation.tests.push(dst.clone());
             } else if target.is_bin() {
                 cx.compilation.binaries.push(dst.clone());
-            } else if target.is_lib() && target.get_profile().is_compile() {
+            } else if target.is_lib() {
                 let pkgid = pkg.get_package_id().clone();
                 cx.compilation.libraries.find_or_insert(pkgid, Vec::new())
                                         .push(root.join(filename));
index d15977dce72a84bd1093a672540ef9352137a38a..fc391bc9aa2a0aa4a02c0c38a4cf47d7876c56e5 100644 (file)
@@ -714,9 +714,6 @@ test!(dep_with_submodule {
             pub fn foo() { dep1::dep() }
         ");
 
-    let root = project.url();
-    let git_root = git_project.url();
-
     assert_that(project.cargo_process("cargo-build"),
         execs().with_stderr("").with_status(0));
 })
index b14043162c1cfec7bbaca6189b349fd04aea54c3..f1a1c68c2c283c88eb304ec215d555ccb3526644 100644 (file)
@@ -498,13 +498,15 @@ test!(lib_with_standard_name {
             name = "syntax"
             version = "0.0.1"
             authors = []
-
-            [[lib]]
-            name = "syntax"
-            test = false
         "#)
         .file("src/lib.rs", "
+            /// ```
+            /// syntax::foo();
+            /// ```
             pub fn foo() {}
+
+            #[test]
+            fn foo_test() {}
         ")
         .file("tests/test.rs", "
             extern crate syntax;
@@ -517,15 +519,29 @@ test!(lib_with_standard_name {
                 execs().with_status(0)
                        .with_stdout(format!("\
 {compiling} syntax v0.0.1 ({dir})
+{running} target[..]test[..]syntax-[..]
+
+running 1 test
+test foo_test ... ok
+
+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured\n\n\
+
 {running} target[..]test[..]test-[..]
 
 running 1 test
 test test ... ok
 
+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured\n\n\
+
+{doctest} syntax
+
+running 1 test
+test foo_0 ... ok
+
 test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured\n\n\
                        ",
                        compiling = COMPILING, running = RUNNING,
-                       dir = p.url()).as_slice()));
+                       doctest = DOCTEST, dir = p.url()).as_slice()));
 })
 
 test!(lib_with_standard_name2 {